
/**
 * Created by xiongshilin on 2017/4/14.
 */
(function(){
    ADF.editpart.BootstrapContainerEditPart = function(){
        ADF.editpart.BootstrapContainerEditPart.superclass.constructor.call(this);
    }
    COM.util.defineClass(ADF.editpart.BootstrapContainerEditPart, ADF.editpart.CompositeEditpart,{
        _createFigure: function(){
            var figure = new ADF.figure.BootstrapContainerFigure();
            var containerControl = this.getWidgetFactory().createControl(this.getModel());
            figure.setWidget(containerControl);

            var border = new COM.draw2d.LineBorder(4,new COM.draw2d.Color(255,255,255,0));
            //figure.setBorder(border);
            return figure;
        },

        createEditPolicies: function(){
            ADF.editpart.BootstrapContainerEditPart.superclass.createEditPolicies.call(this);
            //this.installEditPolicy(COM.gef.EditPolicy.CONTAINER_ROLE, new COM.demo.DiagramContainerEditPolicy());
            this.installEditPolicy(COM.gef.EditPolicy.LAYOUT_ROLE, new ADF.policy.BootstrapContainerLayoutPolicy());
        },

        getModelChildren: function(){
            var children = this.getModel().getChildren();
            /*children.forEach(function(child, index, array){
                //child.setX(0);child.setY(0);
            });*/
            return children;
        },
        refreshVisuals: function(bounds) {

        },
        updateConstraint: function(bounds) {
            var constrain = new COM.draw2d.Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);
            this.getParent().getFigure().setConstraint(this.getFigure(), constrain);
        }
    });
})();